package factory

import "fmt"

type Config struct {
	Info          *Info          `yaml:"info"`
	Configuration *Configuration `yaml:"configuration"`
	Logger        *Logger        `yaml:"logger"`
}

type Info struct {
	Version     string `yaml:"version"`
	Description string `yaml:"description"`
}

type Configuration struct {
	Ip     string `yaml:"ip"`
	Port   int    `yaml:"port"`
	WebDir string `yaml:"webDir"`
}

type Logger struct {
	LogLevel string `yaml:"logLevel"`
}

func (c *Config) Validate() error {
	if c.Info == nil {
		return fmt.Errorf("info is nil")
	}
	if c.Configuration == nil {
		return fmt.Errorf("configuration is nil")
	}
	if c.Logger == nil {
		return fmt.Errorf("logger is nil")
	}
	return nil
}
